package chapter7;

import java.io.ByteArrayInputStream;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Writer;

public class InputStreamReaderTest {

	public static void main(String[] args) throws IOException {

		InputStreamReaderTest isrt = new InputStreamReaderTest();

		isrt.test("ewqejioqwewqewq");
	}
/**
 * 
 * @param aaaa
 * @throws IOException
 */

	public void test(String aaaa) throws IOException {
		byte[] bytes = aaaa.getBytes();

		InputStream is = new ByteArrayInputStream(bytes);

		InputStreamReader isr = new InputStreamReader(is);

		Writer wr = new CharArrayWriter();

		StringBuilder sb = new StringBuilder();

		int data = -1;

		while ((data = isr.read()) != -1) {

			sb.append(data);
		}

		System.out.println(sb);
		
		is.close();
		
		wr.close();
	}
}